package cn.sangedon.review.data;

import cn.sangedon.review.common.service.data.CacheService;
import cn.sangedon.review.data.schedule.ScheduleDispatch;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * 应用启动后执行
 */
@Slf4j
@Component
public class PostStartApplication implements ApplicationRunner {
    @Autowired
    private CacheService cacheService;

    @Autowired
    private ScheduleDispatch scheduleDispatch;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        cacheService.refreshStockDayInfo();

        scheduleDispatch.refresh();
    }
}
